package com.freesky.web.manager.remote.order;

import com.freesky.common.pojo.ZTreeNode;
import com.freesky.common.utils.reponse.JSONResponse;
import com.freesky.common.dao.entity.ItemCat;
import com.freesky.web.manager.remote.order.fallback.ItemCatRemoteFallback;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "emall-provider-zuul", fallback = ItemCatRemoteFallback.class)
public interface ItemCatRemote {
    String ZUUL_URL_PREFIX = "/mysevice/order";
    String URL_PREFIX = "/item/cat";

    @GetMapping(value =  ZUUL_URL_PREFIX + URL_PREFIX + "/list")
    List<ZTreeNode> getItemCatList(@RequestParam(name = "id", defaultValue = "0") int parentId);

    @PutMapping(value = ZUUL_URL_PREFIX + URL_PREFIX +  "/add")
    JSONResponse addItemCategory(@RequestBody ItemCat itemCat);

    @PostMapping(value = ZUUL_URL_PREFIX + URL_PREFIX +  "/update")
    JSONResponse updateItemCategory(@RequestBody ItemCat itemCat);

    @DeleteMapping(value =  ZUUL_URL_PREFIX + URL_PREFIX + "/del/{id}")
    JSONResponse deleteItemCategory(@PathVariable(value = "id") Long id);
}
